<?php include_once "header.php" ?>
    <div class="tm-home-img-container">
      <img src="uploads/tm-home-img.jpg" alt="Image" class="img-fluid"></div>
    <section class="tm-section">
      <div class="container-fluid">

        <div class="row">
          <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 text-xs-center">
            <h2 class="tm-gold-text tm-title">Introduction</h2>
            <p class="tm-subtitle" id="introl"></p></div>
        </div>

        <div class="row" id="list">

        </div>

      </div>
        
    </div>
  </section>

<?php include_once"footer.php" ?>

<script type="text/javascript">
  $(function(){

    //文章异步
    $.ajax({
      url:'api/search.php',
      type:'get',
      dataType:'json',
      data:{action:'index_blog',limit:4},
      success:function(data){
        // console.log(data);
        var dt = data.data;
        var str = '';
        $.each(dt,function(k,v){
          str +='<div class="col-xs-12 col-sm-6 col-md-6 col-lg-3 col-xl-3">'
          str +='    <div class="tm-content-box">'
          str +='      <img src="uploads/'+ v['art_img'] +'" alt="Image" class="tm-margin-b-20 img-fluid">'
          str +='      <h4 class="tm-margin-b-20 tm-gold-text">' + v['art_title'] + '</h4>'
          str +='      <p class="tm-margin-b-20">' + v['art_desc'] + '</p>'
          str +='      <a href="blog.php?id='+ v['art_id'] +'" class="tm-btn text-uppercase">Read More</a>'
          str +='    </div>'
          str +='  </div>' 
        });
        $('#list').empty().append(str);
      }
    })

  })
  
</script>

